package cz.muni.fi.pa165.hauntedhouses.dao;

import cz.muni.fi.pa165.hauntedhouses.entity.House;
import java.util.List;

/**An interface for House Entity, containing basic CRUD operations, plus some other findBy methods.
 *
 * @author Siliarus (Novotný Matěj 374505)
 */
public interface HouseDAO {
    
    
    /** Checks if given House is correct and stores it into the DB
     *
     * @param house house entity we want to add to database
     * @throws IllegalArgumentException if parameter itself or any of its attributes
     * is null or, in case of strings, empty. Also throws this exception in case the House has
     * already assigned ID.
     */
    void create (House house);
    
    /** Checks if given House is correct and present in the DB and updates it in the DB.
     *
     * @param house the house we want to update
     * @throws IllegalArgumentException if parameter itself or any of its attributes
     * is null or, in case of strings, empty.
     */
    void update (House house);
    
    /**Checks if given House is correct and present is the database, if so, this
     * House will be removed.
     *
     * @param house the house we want to remove
     * @throws IllegalArgumentException if parameter itself or any of its attributes
     * is null or, in case of strings, empty.
     */
    void remove (House house);
    
    /**Returns a House from the DB based on its ID. If there is no House with
     * such ID, null is returned.
     *
     * @param id id of a House we want to search in the DB
     * @return null if there is no House with given ID, House otherwise
     * @throws IllegalArgumentException if id is null or < 0
     */
    House get (Long id);
    
    /**Returns list of all the houses in the DB. If there are no houses, empty list
     * is returned
     *
     * @return List of all houses. Empty list of there are no houses.
     */
    List<House> findAll ();
    
    /**Returns list of all houses filtered by their name, which is given as parametr.
     *
     * @param name name (or part of the name) of the house/s we want to search for
     * @return List of all houses which name contains given String, empty list if no House contains it.
     * @throws IllegalArgumentException if given string is either null or empty
     */
    List<House> findByName (String name);
}
